﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Configuration;

namespace RecordBeRun
{
    public partial class DeleteUser : Form
    {
        public DeleteUser()
        {
            InitializeComponent();
            lbl_msg.Text = this.MSG;
        }
        public DeleteUser(string msg)
        {
            InitializeComponent();
            lbl_msg.Text = msg;
        }
        public string MSG { get; set; }

        private void btn_Confirm_Click(object sender, EventArgs e)
        {
            /*
             * 这里你可以这样获取你想定义的密码的hashcode
            */
            //var testpwd = "weichi";
            //var pwdhashcode = testpwd.GetHashCode();
            //MessageBox.Show(pwdhashcode.ToString());//你从弹出的对话框复制那个hashcode，拷贝到配置文件中。

            var pwdtemp = txb_pwd.Text.Trim();
            var hashpwdtemp = pwdtemp.GetHashCode();
            var appConfigPWD=ConfigurationSettings.AppSettings["pwd"];
            if (hashpwdtemp.ToString() == appConfigPWD)
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            else
                this.DialogResult = System.Windows.Forms.DialogResult.No;
        }
    }
}
